<template>
	<view class="container">
		<view class="list_con">
			<view class="list_item" v-for="(item, index) in itemList" :key='index'>
				<view style="display: flex;flex-direction: row;">
				<text style="font-size: 32rpx;">关联订单ID：{{item.orderId}}</text>
					<view style="color: blue;margin-left: 20rpx;" @click='goOrder(item.orderId)'>查看</view>
				</view>
				<view style="display: flex;flex-direction: row;margin-top: 10rpx">
					<view style="">资产ID：{{item.id}}</view>
				</view>
				<view style="display: flex;flex-direction: row;margin-top: 10rpx">
					<view style="">锁定时间：{{$time.dateFormat('YYY-MM-DD hh:mm:ss', item.createTime)}}</view>
				</view>
				<view style="display: flex;flex-direction: row;margin-top: 10rpx">
					<view style="">来自用户ID：{{item.userModel.code}}</view>
				</view>
				<view style="display: flex;flex-direction: row;margin-top: 10rpx">
					<view class="center_row">
						<view>
							<text style="">总锁仓：{{item.money}}</text>
							<text style="margin-left: 40rpx;">待释放：{{item.moneyLocked}}</text>
						</view>
					</view>
				</view>
				<view style="display: flex;flex-direction: column;">
					<view style=";margin-top: 10rpx;font-size: 24rpx;">锁仓释放记录：</view>
					<view class="" v-if="item.freeRecordList && item.freeRecordList.length>0">
						<view v-for="(item, index) in item.freeRecordList" :key='index' style="font-size: 24rpx;color: #999999;"> {{$time.dateFormat('YYY-MM-DD hh:mm:ss', item.createTime)}}释放锁定积分{{item.money}} </view>
					</view>
					<view v-else style="font-size: 24rpx;color: #999999;">未开始释放</view>
				</view>
				
			</view>
		</view>
		<view style="margin-top: 200rpx;"><u-empty text="暂无记录" mode="list" v-if="itemList.length < 1"></u-empty></view>
	</view>
</template>

<script>
	import { recordIncomesLocked } from '@/api/recordIncomesLocked.js'
	export default{
		components: {},
		data() {
			return {
				page: 1,
				size: 20,
				itemList: [],
				showEmpty: false,
				isLastPage: false
			}
		},
		onLoad() {
			var title = this.$Route.query.title
			uni.setNavigationBarTitle({
				title: title
			})
			this.getItemList()
		},
		onPullDownRefresh() {
			this.page = 1
			this.getItemList()
		},
		onReachBottom() {
			if(this.isLastPage) {
				return
			}
			this.getItemList()
		},
		methods:{
			goOrder(orderId){
				this.$Router.push({
					name: 'orderDetail',
					params: {
						orderId: orderId
					}
				})
			},
			property(flag, val){
				recordIncomesLocked.properayHandle({
					handleType: flag,
					obj_id: val.id
				}).then(res => {
					this.getItemList()
					if (res.data.code == 10000) {
						
					}
				})
			},
			getItemList() {
				var params = {
					page: this.page,
					size: this.size,
					user: this.$storage.getStorageDataSync(this.$store.state.userInfo).id,
				}
				recordIncomesLocked.getRecordIncomesLockedList(params).then(res => {
					uni.stopPullDownRefresh();
					if (res.data.code == 10000) {
						if(this.page == 1){
							this.itemList = []
						}
						var list = res.data.data.list
						this.itemList = [...this.itemList, ...list]
						this.showEmpty = this.itemList.length<1
						if (res.data.data.next) {
							this.page += 1
						} else {
							this.isLastPage = true
						}
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.list_con{
		width: 710rpx;
		margin-left: 20rpx;
		display: flex;
		flex-direction: column;
		border-radius: 12rpx;
		.list_item{
			display: flex;
			flex-direction: column;
			background-color: #FFFFFF;
			margin-top: 18rpx;
			padding: 20rpx;
			.icon{
				width: 80rpx;
				height: 80rpx;
			}
			.center{
				width: 100%;
				margin-left: 20rpx;
				display: flex;
				flex-direction: column;
				.center_row{
					width: 100%;
					// margin: 0 30rpx;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: space-between;
				}
			}
			.right{
				flex-shrink: 0;
				text{
					color: #000000;
					font-weight: bold;
				}
			}
		}
	}
	.footer{
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: flex-end;
		margin-top: 20rpx;
		padding-top: 30rpx;
		border-top: 1px solid #EFEFEF;
	}
</style>
